package 正则表达式;

public class qq账号校验 {
    public static void main(String[] args) {
        String s="2609771489";
        System.out.println(jy(s));//true
        System.out.println(jy2(s));//true
    }
    public  static  boolean jy2(String qq){
        return qq != null && qq.matches("\\d{6,20}");//正则表达式
    }
    public static boolean jy(String qq){
        if (qq == null || qq.length()>20 || qq.length()<6){
            return false;
        }else{
            for (int i = 0; i < qq.length(); i++) {
                char t= qq.charAt(i);
                if(t>'9' || t<'0'){
                    return false;
                }
            }
        }
        return true;
    }
}
